<template>
	<view class="my-card">
		<view class="title">
			{{itemObj.name}}
		</view>
		<view class="price">
			{{itemObj.price}}
		</view>
		<view class="desc">
			<text>{{itemObj.subscribe}}</text>
			<!-- 状态 -->
			<label class="radio" v-if="isRadio" @click="$emit('checks')">
				<radio :checked="itemObj.check" />
			</label>
			<!-- 按钮 -->
			<!-- 把json数据中的状态state当做stateList的下标 -->
			<text class="type-btn" v-else @click="$emit('changeStatus')">{{stateList[itemObj.state]}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"myCart",
		props:{
			itemObj:Object,
			isRadio:Boolean
		},
		data() {
			return {
				
				stateList:['付款','发货','收货','再来一单']
			};
		}
	}
</script>

<style lang="scss">
.my-card{
	padding: 10px 16px;
	box-sizing: border-box;
	.title{
		font-size: 28rpx;
		font-weight: 700;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.price{
		font-size: 24rpx;
	}
	.desc{
		display: flex;
		align-items: center;
		justify-content: space-between;
		.type-btn{
			width: 100rpx;
			height: 65rpx;
			text-align: center;
			line-height: 65rpx;
			color: #fff;
			font-size: 24rpx;
			background: #7e953a;
			border-radius: 8rpx;
		}
	}
	
}
</style>